//
//  sstNSDataFormat.m
//  OpensslTest
//
//  Created by jiahua on 16/3/30.
//  Copyright © 2016年 secsmarts. All rights reserved.
//

#import "sstNSDataFormat.h"
@implementation sstNSDataFormat

+(u8*)NSData2Char:(NSData*)data;{
    NSString* strData = [sstNSDataFormat NSData2NSString:data];
    u8* bufferData = (u8 *)[strData UTF8String];
    return bufferData;
}

+(NSData*)Char2NSData:(u8 *)str withLen:(int)strlen{
    NSData* data = [NSData dataWithBytes: (const char *)str length:strlen];
    return data;
}

+(NSString*)NSData2NSString:(NSData *)data{
    NSString* str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    return str;
}

+(Byte*)NSData2Byte:(NSData*)data{
    Byte* dataByte = (Byte*)[data bytes];
    return dataByte;
}

@end
